//
//  VectorClass.hpp
//  Practice11
//
//  Created by 赵世杰 on 2020/7/25.
//  Copyright © 2020 zhaoshijie. All rights reserved.
//

#ifndef VectorClass_hpp
#define VectorClass_hpp

#include <stdio.h>
#include <iostream>

#endif /* VectorClass_hpp */


namespace VECTOR {

class Vector
{
public:
    enum Mode{RECT,POL};
    
private:
    double x;
    double y;
    double mag;
    double ang;
    
    Mode mode;
    
    void set_mag();
    void set_ang();
    void set_x();
    void set_y();
    
public:
    Vector();
    Vector(double n1,double n2,Mode form=RECT);
    void reset(double n1,double n2,Mode form=RECT);
    ~Vector();
    double xval()const{return x;};
    double yval()const{return y;};
    double magval()const{return mag;};
    double angval()const{return ang;};
    
    void polar_mode();
    void rect_model();
    
    Vector operator+(const Vector &b)const;
    Vector operator-(const Vector &b)const;
    Vector operator-()const;
    Vector operator*(double n)const;
    
    friend Vector operator*(double n,const Vector &a);
    friend std::ostream & operator<<(std::ostream & os,const Vector & v);
    
    
};


}

